var NG_scripts = new function() {
	var that = this;

	function main_scripts() {
		return ["chrome://ninjagrammarian/content/NG_display.js",
				"chrome://ninjagrammarian/content/NG_main.js",
				"chrome://ninjagrammarian/content/NG_grammar.js"
				];
	}

	function shared_scripts() {
		return [ "chrome://ninjagrammarian/content/NG_enum.js",
				 "chrome://ninjagrammarian/content/NG_generated.js",
				 "chrome://ninjagrammarian/content/NG_util.js"];
				 
	}
	
	function all_scripts() { return shared_scripts().concat(main_scripts()); }

	this.loadSharedXULScripts = function() { that.loadXULScripts(shared_scripts()); };

	this.loadAllScripts = function() {
		that.loadSharedXULScripts();
		that.loadXULScripts(main_scripts());
	};

	this.loadXULScripts = function(scriptArray) {
		var jsLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
		for (scriptName in scriptArray) { jsLoader.loadSubScript(scriptArray[scriptName]); }
	};

	function staticLoadScript(url) { document.write('<script src="', url, '" type="text/JavaScript"><\/script>'); }

	/*
	 * This is just called from JSUnit
	 */
	this.loadHTMLScripts = function() {		
		for (scriptName in all_scripts()) { staticLoadScript(all_scripts()[scriptName]); }				
	};
};
